/*
 * FileName: ScheduledUtil.java
 * Author:   zzw
 * Date:     2018年08月21日
 * Description:
 */
package com.zzw.utils;


import com.zzw.thread.factory.NamedThreadFactory;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 〈定时调度〉<br>
 * 〈〉
 *
 * @author zzw
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本]（可选）
 */
public class ScheduledUtil {

    private static final ScheduledThreadPoolExecutor scheduleThreadPool = new ScheduledThreadPoolExecutor(5,
            new NamedThreadFactory("jvm", false));

    public static void addTask(Thread task) {
        if (task != null) {
            try {
                scheduleThreadPool.scheduleAtFixedRate(task, 0, 10, TimeUnit.SECONDS);
            } catch (Throwable t) {
                t.getMessage();
            }
        }
    }
}
